import { IFeidaoAiBrowserComponent } from '@feidao/web/interfaces';

export default async function a006(fd: IFeidaoAiBrowserComponent, ...args: any[]) {
	console.log('筛选　空');
	const check_input = args[0].target;
	const check_id = check_input.getAttribute('data-feidao-id');
	const input_id = check_id.replace("check_", "input_");
	const input = fd.data.node.querySelector('[data-feidao-id=' + input_id + ']') as HTMLInputElement;
	if (check_input.checked) {
		if (input) {
			input.value = "";
			input.setAttribute("disabled", "disabled");
		} else {
			const begin_input = fd.data.node.querySelector("#" + check_id.replace("check_", "begin_")) as HTMLInputElement;
			const end_input = fd.data.node.querySelector("#" + check_id.replace("check_", "end_")) as HTMLInputElement;
			begin_input.value = "";
			end_input.value = "";
			begin_input.setAttribute("disabled", "disabled");
			end_input.setAttribute("disabled", "disabled");
		}
	} else {
		if (input) {
			input.removeAttribute("disabled");
		} else {
			const begin_input = fd.data.node.querySelector("#" + check_id.replace("check_", "begin_")) as HTMLInputElement;
			const end_input = fd.data.node.querySelector("#" + check_id.replace("check_", "end_")) as HTMLInputElement;
			begin_input.removeAttribute("disabled");
			end_input.removeAttribute("disabled");
		}
	}
}
